package com.liferay.OTP;
import org.apache.commons.codec.binary.BinaryCodec;

public class OTPCipherText {
	public final String OTP_HEADER_OPENTAG = "<OTPHEADER>";
	public final String OTP_HEADER_CLOSETAG = "</OTPHEADER>";
	public final String OTP_KEY_OPENTAG = "<OTP_KEY_ID>";
	public final String OTP_KEY_CLOSETAG = "</OTP_KEY_ID>";
	public final String OTP_CIPHER_OPENTAG = "<CIPHER_ID>";
	public final String OTP_CIPHER_CLOSETAG = "</CIPHER_ID>";
	public final String OTP_BITSTREAM_OPENTAG = "<BITSTREAM>";
	public final String OTP_BITSTREAM_CLOSETAG = "</BITSTREAM>";
	private  String cipherBitStream = "";
	private  String CipherTextString = "";
	private String CipherTextID = "";
	private byte [] CipherTextAsciiArray;
	
	public OTPCipherText(String bitStream){
		cipherBitStream = bitStream;
		BinaryCodec bc = new BinaryCodec();
		CipherTextString = OTPServiceUtil.BitStreamTotext(cipherBitStream);
	}
	
	public  String getString(){
		return CipherTextString;
	}
	
	/*Sets the CipherTextID*/
	public void setID(String newID){
		CipherTextID = newID;
	}
	

	
	/*Returns the ID of the Ciphertext*/
	public String getID(){
		return CipherTextID;
	}
	/*Returns the bitstream of the Ciphertext*/
	public String getBitStream(){
		return cipherBitStream;
	}
	
	public String toBody(){
		String retStr = OTP_HEADER_OPENTAG + OTP_CIPHER_OPENTAG +CipherTextID +OTP_CIPHER_CLOSETAG + OTP_HEADER_CLOSETAG + OTP_BITSTREAM_OPENTAG + cipherBitStream +  OTP_BITSTREAM_CLOSETAG; 
				
		return retStr;
		
	}
}
